<template>
    <div>
        <!-- 面包屑导肮 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>权限管理</el-breadcrumb-item>
            <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>
        <!-- 卡片 -->
        <el-card class="box-card">

            <el-table class="rightsTable" :data="rightsList" stripe border>
                <el-table-column type="index" />
                <el-table-column label="权限名称" prop="authName" width="180" />
                <el-table-column label="路径" prop="path" width="180" />
                <el-table-column label="权限等级" width="180">
                    <template #default="scope">
                        <el-tag v-show="scope.row.level==='0'">一级</el-tag>
                        <el-tag v-show="scope.row.level==='1'" type="success">二级</el-tag>
                        <el-tag v-show="scope.row.level==='2'" type="warning">三级</el-tag>
                    </template>
                </el-table-column>

            </el-table>

        </el-card>

    </div>
</template>

<script>
import { reqRightList } from '@/api'
export default {
    created() {
        //发送请求拿到用户列表
        this.getRightsList()
    },

    data() {
        return {
            rightsList: []
        }
    },
    methods: {
        async getRightsList() {
            const {
                data,
                meta: { msg, status }
            } = await reqRightList('list')
            if (200 !== status) return this.$message.error(msg)
            this.$message.success(msg)
            this.rightsList = data
        }
    }
}
</script>
<style lang="less" scoped>
.rightsTable{
    text-align: center;
}
</style>